C Interview Questions and Answers
Question: Detemine the code below, tell me exectly how many times is the operation sum++ performed ?Answer:for ( i = 0; i < 100; i++ ) for ( j = 100; j > 100 - i; j?) sum++; (99 * 100)/2 = 4950 The sum++ is performed 4950 times. |
Is it helpful?
Yes
No
Most helpful rated by users:
- What is C++?
- What is function overloading and operator overloading?
- How do you find out if a linked-list has an end? (i.e. the list is not a cycle)
- What is the difference between declaration and definition?
- What is the difference between realloc() and free()?